<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>标题</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>

<table class="layui-hide" id="dataList" lay-filter="dataList"></table>
<script type="text/html" id="toolbarOrg">
    <div class="layui-btn-container">
    </div>
</script>
<script type="text/html" id="barDemo">
    {{# if(d.employStatus==4){ }}
    <a class="layui-btn layui-btn-xs" lay-event="agree">同意</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="refuse">拒绝</a>
    {{# } }}
</script>

<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    layui.use(['jquery', 'configureCom', 'configure', 'table', 'sessionFun'], function () {
        var $ = layui.jquery;
        var configure = layui.configure;
        var matchDict = layui.matchDict;
        var table = layui.table;
        var sessionFun = layui.sessionFun;
        var configureCom = layui.configureCom;

        var cols = [[
            {field: 'orgName', title: '企业名称'},
            {
                field: 'seal', title: '从事岗位', templet: function (d) {
                    return '<p>' + matchDict.name(d.seal, configure.DUTY_TYPE_CODE) + '</p>';
                }
            },
            {field: 'launchDate', title: '请求日期'},
            {field: 'procesDate', title: '业务处理日期'},
            {
                field: 'employStatus', title: '状态', templet: function (d) {
                    return '<p>' + matchDict.name(d.employStatus, configure.EMPLOY_STATUS) + '</p>';
                }
            },

            {title: '操作', toolbar: '#barDemo', width: 150}
        ]];
        configureCom.tableRender(configure.ZIZHI_COM_EMPLOY_LIST_HTTP, {}, cols, 'dataList', 10, '', 'toolbarOrg');

        //每行操作
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            sessionFun.set(configure.SESSION_LIST_DATA, data);
            if (obj.event === 'refuse') {//查看详情
                top.layer.prompt({
                    formType: 2,
                    title: '拒绝原因',
                    area: ['400px', '300px'] //自定义文本域宽高
                }, function (value, index, elem) {
                    configureCom.postDataAjax(configure.ZIZHI_EMPLOY_REFUSE_HTTP, {
                        orgNo: data.orgNo,
                        reasonRef: value
                    }).then(function (res) {
                        top.layer.msg('修改成功！');
                        top.layer.close(index);
                        configureCom.tableReload(true);
                    })
                });
            } else if (obj.event === 'agree') {
                top.layer.confirm('确认同意入职吗？', function (index, layero) {
                    configureCom.postDataAjax(configure.ZIZHI_EMPLOY_AGREE_HTTP, {orgNo: data.orgNo}).then(function (res) {
                        top.layer.msg('入职成功！');
                        top.layer.close(index);
                        configureCom.tableReload(true);
                    })
                });
            }
        });
    });

</script>
</body>
</html>